import {abstractValidator} from "./abstractValidator";
import {validatorEnum} from "./validatorEnum";
import {validatorManage} from "./validatorManage";
/**
 * Created by ybjaa on 2017/6/28.
 * 创建验证的建造类
 */
export class buildValidator{

    public validators:abstractValidator[]=[];

    public add(enumType:validatorEnum,messagePrefix:string="",...args:Array<string>[]):buildValidator{

        let validator=null;

        validator=validatorManage.GetValidatorClasses(enumType);

        if(validator){
            validator.setMessagePrefix(messagePrefix);
            validator.setParameters(args);
            this.validators.push(validator);
        }
        return this;

    }


}